home *** CD-ROM | disk | FTP | other *** search
- property pSprite, pUndoTrigger
- global gSize, gCast, gVariable, gFirstColor, gSecondColor, gShapeType, gRectStyle, gOvalStyle, myCurrentImage, pPixelActorListX, pPixelActorListY, pSpreadListX, pSpreadListY
-
- on beginSprite me
- pSprite = sprite(me.spriteNum)
- pUndoTrigger = 0
- end
-
- on mouseWithin me
- put (the mouseH - sprite(1).left) * 2 / gVariable / 2 into field "location status X"
- put (the mouseV - sprite(1).top) * 2 / gVariable / 2 into field "location status Y"
- end
-
- on mouseEnter me
- if sprite(64).pState = 1 then
- pSprite.cursor = 256
- else
- if sprite(65).pState = 1 then
- pSprite.cursor = [352, 353]
- else
- if sprite(66).pState = 1 then
- pSprite.cursor = 259
- else
- if sprite(67).pState = 1 then
- pSprite.cursor = [344, 345]
- else
- if sprite(68).pState = 1 then
- pSprite.cursor = 271
- gShapeType = #rect
- else
- if sprite(73).pState = 1 then
- pSprite.cursor = 271
- gShapeType = #oval
- else
- if sprite(78).pState = 1 then
- pSprite.cursor = 271
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end
-
- on mouseLeave me
- pSprite.cursor = 0
- put EMPTY into field "location status X"
- put EMPTY into field "location status Y"
- end
-
- on mouseDown
- if pUndoTrigger = 0 then
- pUndoTrigger = 1
- end if
- if sprite(64).pState = 1 then
- tool1PxPencil()
- else
- if sprite(65).pState = 1 then
- tool1PxEraser()
- else
- if sprite(66).pState = 1 then
- toolFill()
- else
- if sprite(67).pState = 1 then
- toolCheckerFill()
- else
- if sprite(68).pState = 1 then
- if gRectStyle = "outline" then
- toolOutlineShape()
- else
- if gRectStyle = "filled" then
- toolFilledShape()
- else
- if gRectStyle = "solid" then
- toolSolidShape()
- end if
- end if
- end if
- else
- if sprite(73).pState = 1 then
- if gOvalStyle = "outline" then
- toolOutlineShape()
- else
- if gOvalStyle = "filled" then
- toolFilledShape()
- else
- if gOvalStyle = "solid" then
- toolSolidShape()
- end if
- end if
- end if
- else
- if sprite(78).pState = 1 then
- toolStraightLine()
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end
-
- on mFlood me, aX, aY, aSourceColor
- targetColor = myCurrentImage.getPixel(aX, aY)
- myCurrentImage.setPixel(aX, aY, aSourceColor)
- append(pPixelActorListX, aX)
- append(pPixelActorListY, aY)
- repeat while count(pPixelActorListX)
- xCur = getAt(pPixelActorListX, 1)
- yCur = getAt(pPixelActorListY, 1)
- deleteAt(pPixelActorListX, 1)
- deleteAt(pPixelActorListY, 1)
- repeat with n = 1 to 4
- xTest = xCur + getAt(pSpreadListX, n)
- yTest = yCur + getAt(pSpreadListY, n)
- if myCurrentImage.getPixel(xTest, yTest) = targetColor then
- myCurrentImage.setPixel(xTest, yTest, aSourceColor)
- append(pPixelActorListX, xTest)
- append(pPixelActorListY, yTest)
- end if
- end repeat
- end repeat
- end
-
- on mFlood2 me, aX, aY, aSourceColor
- targetColor = myCurrentImage.getPixel(aX, aY)
- myCurrentImage.setPixel(aX, aY, aSourceColor)
- append(pPixelActorListX, aX)
- append(pPixelActorListY, aY)
- repeat while count(pPixelActorListX)
- xCur = getAt(pPixelActorListX, 1)
- yCur = getAt(pPixelActorListY, 1)
- deleteAt(pPixelActorListX, 1)
- deleteAt(pPixelActorListY, 1)
- repeat with n = 1 to 4
- xTest = xCur + getAt(pSpreadListX, n)
- yTest = yCur + getAt(pSpreadListY, n)
- if myCurrentImage.getPixel(xTest, yTest) = targetColor then
- if (((aX mod 2) = 1) and ((aY mod 2) = 0)) or (((aX mod 2) = 0) and ((aY mod 2) = 1)) then
- if (((xTest mod 2) = 1) and ((yTest mod 2) = 0)) or (((xTest mod 2) = 0) and ((yTest mod 2) = 1)) then
- myCurrentImage.setPixel(xTest, yTest, aSourceColor)
- append(pPixelActorListX, xTest)
- append(pPixelActorListY, yTest)
- else
- myCurrentImage.setPixel(xTest, yTest, targetColor)
- append(pPixelActorListX, xTest)
- append(pPixelActorListY, yTest)
- end if
- next repeat
- end if
- if (((xTest mod 2) = 1) and ((yTest mod 2) = 0)) or (((xTest mod 2) = 0) and ((yTest mod 2) = 1)) then
- myCurrentImage.setPixel(xTest, yTest, targetColor)
- append(pPixelActorListX, xTest)
- append(pPixelActorListY, yTest)
- next repeat
- end if
- myCurrentImage.setPixel(xTest, yTest, aSourceColor)
- append(pPixelActorListX, xTest)
- append(pPixelActorListY, yTest)
- end if
- end repeat
- end repeat
- end
-